Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid panic when getting EntityCommands in hierarchy #666

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

msvbg
Copy link
Contributor

@msvbg msvbg commented Oct 7, 2024

Lightyear seems to panic when despawning children with an error message like:

thread 'Compute Task Pool (6)' panicked at lightyear/src/shared/replication/hierarchy.rs:111:30:
Attempting to create an EntityCommands for entity Entity { index: 720, generation: 1 }, which doesn't exist.

This PR adds a test case and attempts a fix.

Copy link
Owner

@cBournhonesque cBournhonesque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I thought that calling iter_descendants was guaranteeing that all the children existed, but I guess not?

@cBournhonesque cBournhonesque merged commit a7aed47 into cBournhonesque:main Oct 7, 2024
3 of 5 checks passed
@msvbg msvbg deleted the avoid_panic_in_hierarchy branch October 7, 2024 19:35
@msvbg
Copy link
Contributor Author

msvbg commented Oct 7, 2024

Yeah I'm also a little confused why actually, but I have seen quite a few similar panics from my own code so I think the answer is no.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants